package io.kwdb.examples;

import io.kwdb.sdk.*;

public class TestIlpRaw {
  public static void main(String[] args) {
    Config config =
        Config.builder().host("127.0.0.1").httpPort(9091).transport(Config.Transport.ILP).build();

    try (IlpClient client = new IlpClient(config)) {
      // Test with a simple raw ILP line
      String ilpLine = "sdk_bench,host=raw-test,region=us-west usage=99.9";
      System.out.println("Sending raw ILP: " + ilpLine);

      Status status = client.writeRaw(ilpLine);
      if (status.isOk()) {
        System.out.println("SUCCESS: Raw ILP write succeeded");
      } else {
        System.out.println("FAILED: " + status.getMessage());
      }

      // Test with timestamp
      ilpLine = "sdk_bench,host=raw-test-2,region=us-east usage=88.8 " + System.nanoTime();
      System.out.println("\nSending raw ILP with timestamp: " + ilpLine);

      status = client.writeRaw(ilpLine);
      if (status.isOk()) {
        System.out.println("SUCCESS: Raw ILP write with timestamp succeeded");
      } else {
        System.out.println("FAILED: " + status.getMessage());
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
